/**
 * Fibonaci
 * @author c0909h1334
 
 */

package homework.homework2;

/**
 * Fibonaci entity
 * 
 */
public class Fibonaci {

	/**
	 * @var int temp1
	 */
	int temp1 = 0;
	
	/**
	 * @var int temp2
	 */
	int temp2 = 1;
	
	/**
	 * @var int Fibo
	 */
	int fiboNumber = 1;
	
	
	/**
	 * constructor
	 */
	public Fibonaci() {
	}
	

        /**
         * Display Series
         *
         */
        public void displaySeries() throws InterruptedException {

            //run forever
            while(fiboNumber < 1836311903 ) {

                //display 1 Fibo
                System.out.println(this.fiboNumber);
                
                //check
                this.displayOddAndEven();

                //change temp1, temp2
                this.temp1 = temp2;
                this.temp2 = fiboNumber;
                this.fiboNumber = temp1 + temp2;

                //sleep
                Thread.sleep(1000);

            }

        }


        /**
	 * Gen Fibo number
	  
	 
	 */
	public int genFibonaci() {
		return this.fiboNumber;
	}
	
	/**
	 * Display
	 
	 */
	public void displayOddAndEven() {
		
		//state indicate odd or even
		String state;
		state = (fiboNumber%2 == 0)? "even": "odd";

                //display
		System.out.println(fiboNumber+ " is " +state);
	}
}
